import toml


path = '../data/coin2/feed/symbol_groups.toml'

duplicated = dict()

with open(path, 'r') as f:
    symbol_groups=toml.load(f)
    print(len(symbol_groups.keys()))
    for exchange in symbol_groups:
        products=[]
        duplicated_product=[]
        for group in symbol_groups[exchange]:
            for product in symbol_groups[exchange][group]:
                if product in products:  
                    duplicated_product.append((group,product))
                else:
                    products.append(product)
        if len(duplicated_product) > 0 :
            for info in duplicated_product :
                symbol_groups[exchange][info[0]].remove(info[1])
            duplicated[exchange] = duplicated_product
print(duplicated)
        
with open(path, 'w') as f:
    toml.dump(symbol_groups, f)

                
                

